package com.quectel.core.module.mobileuser.dao;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.quectel.core.module.mobileuser.entity.MobileUserCarEntity;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;
import java.util.Map;

/**
 * @author ryan
 * @email ryan.ran@quectel.com
 * @date 2023/04/20 16:51
 */

public interface MobileUserCarDao extends BaseMapper<MobileUserCarEntity> {

    /**
     * 查询列表
     *
     * @param params
     * @return
     */
    List<MobileUserCarEntity> queryList(Map<String, Object> params);

    /**
     * 查询数量
     *
     * @param params
     * @return
     */
    int queryTotal(Map<String, Object> params);

    @Select("<script>select muc.* from mobile_user_car muc LEFT JOIN mobile_user mu on muc.mobile_user_id = mu.id where mu.mobile = #{mobile}" +
            "</script>")
    List<MobileUserCarEntity> selectByMobile(@Param("mobile") String mobile);
}
